package com.sebastian.studies.ch3;

import java.util.Scanner;

public class Excercise_3_8 {

	public static void main(String[] args) {

		System.out.println("Sorting 3 numbers");
		Scanner input = new Scanner(System.in);

		int a, b, c;
		System.out.println("Enter three digitis\n" +
			"First digit: ");
		a = input.nextInt();
		System.out.println("Second digit: ");
		b = input.nextInt();
		System.out.println("Third digit: ");
		c = input.nextInt();
		System.out.println("Not sorted digits are: " + a + " " + b + " " + c);
		System.out.println("Sortng...");

		int temp = 0;
		if(a > b && a > c) {
			temp = a;
			a = c;
			c = temp;
		} else if (a > b) {
			temp = a;
			a = b;
			b = temp;
		} else if (b > c) {
			temp = b;
			b = c;
			c = temp;
		}
		System.out.println("Sorted digits are: " + a + " " + b + " " + c);
		input.close();
	}

}
